﻿/*
 * File: TwoDeeGamePlayBaseScene_Load content.cs
 * Author: Gourav Das
 * Purpose: Load content for 2D gameplay
 * Created: May31 2011
 */

using System;
using System.Linq;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.Threading;
using System.IO;
using _22yards._2D;
using _22yards.Scenes.Helpers;
using _22yards.Core;
using _22yards;
using _22yards.EnumDeclarations;
using _22yards.ThreeD;
using _22yards.Helpers;
using Komires.MataliPhysics;

namespace _22yards.Scenes
{
    /// <summary>
    /// This is a scene that implements the 2D Gameplay screen
    /// </summary>
    partial class GamePlayBaseScene : Scene
    {
        private void Load2DSceneContent()
        {
            //Static Camera
            staticCamera = new StaticCamera(sceneEngine.Game);
            sceneEngine.Game.Components.Add(staticCamera);

            //BirdEye static Camera
            birdEyeViewChaseCamera = new BirdEyeViewBallChaseCamera(sceneEngine.Game);
            sceneEngine.Game.Components.Add(birdEyeViewChaseCamera);

            //RenderTarget for Base screen
            RenderTarget1 = new RenderTarget2D(sceneEngine.GraphicsDevice, sceneEngine.GraphicsDevice.Viewport.Width, sceneEngine.GraphicsDevice.Viewport.Height, true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 8, RenderTargetUsage.PreserveContents);
            //Render Target for Transition screen 1
            RenderTarget2 = new RenderTarget2D(sceneEngine.GraphicsDevice, RtViewPort.Width, RtViewPort.Height, true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 8, RenderTargetUsage.PreserveContents);
            //Render Target for Transition screen2
            RenderTarget3 = new RenderTarget2D(sceneEngine.GraphicsDevice, RtViewPort.Width, RtViewPort.Height, true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 8, RenderTargetUsage.PreserveContents);

            //Load 2D Ball
            TwoDeeBall = content.Load<Texture2D>("TwoDEE/Models/Ball/Cricket_Ball");

            #region Render Targets for Score and info for 11 Batsmen

            rndTargetBatsman1Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman1Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman2Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman2Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman3Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman3Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman4Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman4Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman5Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman5Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman6Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman6Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman7Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman7Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman8Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman8Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman9Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman9Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman10Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman10Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman11Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBatsman11Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);

            #endregion

            #region Render Targets for ScoreCard and SummaryView

            rndTargetScoreCard = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)1366 * Game22Yards.scaleFactor.widthScale), (int)((float)768 * Game22Yards.scaleFactor.htScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetSummary = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);

            #endregion

            #region Render Targets for Score and Info for 11 Bowlers

            rndTargetBowler1Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler1Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler2Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler2Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler3Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler3Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler4Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler4Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler5Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler5Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler6Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler6Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler7Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler7Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler8Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler8Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler9Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler9Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler10Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler10Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler11Info = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);
            rndTargetBowler11Score = new RenderTarget2D(sceneEngine.GraphicsDevice, (int)((float)512 * Game22Yards.scaleFactor.widthScale), (int)((float)512 * Game22Yards.scaleFactor.widthScale), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 4, RenderTargetUsage.PreserveContents);

            #endregion

            //Cache the Normal Viewport for future uses and to restore
            NormalViewPort = sceneEngine.GraphicsDevice.Viewport;

            sceneEngine.GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(GraphicsDevice_DeviceReset);

            //Setting Initial values for infobar and infobar animation
            iInfoBarStartwidth = iInfobarCurrentwidth = 0;
            iInfobarEndWidth = sceneEngine.GraphicsDevice.Viewport.Width;
            iRightSidebarStartheight = iRightSidebarCurrentheight = (int)((float)680 * Game22Yards.scaleFactor.htScale);
            iRightSidebarEndheight = (int)((float)585 * Game22Yards.scaleFactor.htScale);
            iLeftEnclosureStartPosition = iLeftEnclosureCurrentPosition = (int)((float)780 * Game22Yards.scaleFactor.htScale);
            iLeftEnclosureEndPosition = (int)((float)666 * Game22Yards.scaleFactor.htScale);
            bStartSidebarShrinkingTransition = false;

            #region Textures for Base 2D Screen

            backgroundTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPBackground");
            leftSidebarTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPLeftsidebar");
            infobarTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPInfobar");
            leftEnclosureTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPLeftEnclosure");

            scorebarEnclosureTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPScorebarEnclosure");
            scorebarBaseTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPScorebarBase");
            scorebarTexturedTexture = content.Load<Texture2D>("TwoDEE/Screens/2DGP/2DGPScorebarTexture");

            #endregion

            #region HLSL Effects

            simpleEff = content.Load<Effect>("ThreeDEE/Effect/SimpleEffect");
            ColorNormalGlowEff = content.Load<Effect>("ThreeDEE/Effect/ColorNormalGlow");
            PostEffect = content.Load<Effect>(@"ThreeDEE/Effect/PostProcess");

            #endregion

            //Active Batsmen
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat1"), new Vector3(29f * Game22Yards.scaleFactor.widthScale, 11.8f * Game22Yards.scaleFactor.htScale, 49), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame1", 1, 1));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat2"), new Vector3(29f * Game22Yards.scaleFactor.widthScale, 4.4f * Game22Yards.scaleFactor.htScale, 49), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame2", 2, 1));
            //Active Bowlers
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl1"), new Vector3(29f * Game22Yards.scaleFactor.widthScale, -3.6f * Game22Yards.scaleFactor.htScale, 49), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame1", 12, 2));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl2"), new Vector3(29f * Game22Yards.scaleFactor.widthScale, -11.0f * Game22Yards.scaleFactor.htScale, 49), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame2", 13, 2));

            #region Load Remaining batsmen

            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat3"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame3", 5, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat4"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame4", 6, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat5"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame5", 7, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat6"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame6", 8, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat7"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame7", 9, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat8"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame8", 10, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat9"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame9", 11, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat10"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame10", 12, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBat11"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame11", 13, 0));

            #endregion

            #region Load Remaining Bowlers

            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl3"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame3", 14, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl4"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame4", 15, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl5"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame5", 16, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl6"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame6", 17, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl7"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame7", 18, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl8"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, 0 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame8", 19, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl9"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame9", 20, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl10"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BowlerFrame10", 21, 0));
            photoFrames.Add(new PhotoFrameModel(content.Load<Model>("TwoDEE/Models/Photoframes/playerphotoframeBowl11"), new Vector3(-50f * Game22Yards.scaleFactor.widthScale, -10 * Game22Yards.scaleFactor.htScale, 49f), new Vector3(0f, 0f, 0f), new Vector3(0.57f * Game22Yards.scaleFactor.widthScale, 0.6f * Game22Yards.scaleFactor.htScale, 0.6f), sceneEngine.GraphicsDevice, "BatsManFrame11", 22, 0));

            //Batting Team Player Info Base Textures
            texPFBattingTeamPlayer1Info = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/PhotoFrames/Customplayerinfo.png");
            texPFBowlingTeamPlayer11Info = texPFBowlingTeamPlayer10Info = texPFBowlingTeamPlayer9Info = texPFBowlingTeamPlayer8Info = texPFBowlingTeamPlayer7Info = texPFBowlingTeamPlayer6Info = texPFBowlingTeamPlayer5Info = texPFBowlingTeamPlayer4Info = texPFBowlingTeamPlayer3Info = texPFBowlingTeamPlayer2Info = texPFBowlingTeamPlayer1Info = texPFBattingTeamPlayer11Info = texPFBattingTeamPlayer10Info = texPFBattingTeamPlayer9Info = texPFBattingTeamPlayer8Info = texPFBattingTeamPlayer7Info = texPFBattingTeamPlayer6Info = texPFBattingTeamPlayer5Info = texPFBattingTeamPlayer4Info = texPFBattingTeamPlayer3Info = texPFBattingTeamPlayer2Info = texPFBowlingTeamPlayer1Info = texPFBowlingTeamPlayer2Info = texPFBattingTeamPlayer1Info;

            //Batting Team Player Score Base Textures
            texPFBattingTeamPlayer1Score = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/PhotoFrames/Customplayerscore.png");
            texPFBowlingTeamPlayer11Score = texPFBowlingTeamPlayer10Score = texPFBowlingTeamPlayer9Score = texPFBowlingTeamPlayer8Score = texPFBowlingTeamPlayer7Score = texPFBowlingTeamPlayer6Score = texPFBowlingTeamPlayer5Score = texPFBowlingTeamPlayer4Score = texPFBowlingTeamPlayer3Score = texPFBowlingTeamPlayer2Score = texPFBowlingTeamPlayer1Score = texPFBattingTeamPlayer11Score = texPFBattingTeamPlayer10Score = texPFBattingTeamPlayer9Score = texPFBattingTeamPlayer8Score = texPFBattingTeamPlayer7Score = texPFBattingTeamPlayer6Score = texPFBattingTeamPlayer5Score = texPFBattingTeamPlayer4Score = texPFBattingTeamPlayer3Score = texPFBattingTeamPlayer2Score = texPFBattingTeamPlayer1Score;

            //Phone model Textures
            TextureScreen = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/RightSideBar/screen.png");
            TextureSummaryScreen = TextureScoreCardScreen = TextureScreen;
            TextureScreenNormal = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/RightSideBar/screen NRM.png");
            TextureScreenSpec = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/RightSideBar/screen SPEC.png");

            //Right Sidebar model
            rightSideBarModel = new RightSideBarModel(content.Load<Model>("TwoDEE/Models/RightSideBar/RightSideBarInfoSlate"),
                new Vector3(-0.5f * Game22Yards.scaleFactor.widthScale, 0f * Game22Yards.scaleFactor.htScale, 38f),
                new Vector3(0f, 0f, 0f),
                new Vector3(1f * Game22Yards.scaleFactor.widthScale,
                    1f * Game22Yards.scaleFactor.htScale, 1f),
                sceneEngine.GraphicsDevice,
                "SideBar Model", 1, 1);
            rightSideBarModel.OscillationSpeed = 0.05f;

            //Team1 logo model
            Team1Logo = new TeamLogoModel(content.Load<Model>("TwoDEE/Models/TeamLogos/Team1Logo"),
                new Vector3(15f * Game22Yards.scaleFactor.widthScale, 18f * Game22Yards.scaleFactor.htScale, 49f),
                new Vector3(0f, 0f, 0f),
                new Vector3(0.5f,
                    0.5f, 0.5f),
                sceneEngine.GraphicsDevice,
                "Team1Logo", 1, 1);
            //Team2 Logo model
            Team2Logo = new TeamLogoModel(content.Load<Model>("TwoDEE/Models/TeamLogos/Team2Logo"),
                new Vector3(-15f * Game22Yards.scaleFactor.widthScale, 18f * Game22Yards.scaleFactor.htScale, 49f),
                new Vector3(0f, 0f, 0f),
                new Vector3(0.5f * Game22Yards.scaleFactor.widthScale,
                    0.5f * Game22Yards.scaleFactor.htScale, 0.5f),
                sceneEngine.GraphicsDevice,
                "Team2Logo", 2, 2);

            //Team Logo textures
            Team1LogoTexture = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/TeamLogos/Customlogo.png");
            Team2LogoTexture = Team1LogoTexture;
            Team1LogoNormal = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/TeamLogos/Customlogo_N.png");
            Team2LogoNormal = Team1LogoNormal;
            Team1LogoSpec = LoadTextureFromFile(@"22yardsContent/TwoDEE/Models/TeamLogos/Customlogo_S.png");
            Team2LogoSpec = Team1LogoSpec;

            #endregion


            Generate2DSceneEvents();
        }
        /// <summary>
        /// Generates required click events for photoframemodels.
        /// </summary>
        private void Generate2DSceneEvents()
        {
            ////Making the default displayed ones selectable
            photoFrames[0].IsSelectable = true;
            photoFrames[1].IsSelectable = true;
            photoFrames[2].IsSelectable = true;
            photoFrames[3].IsSelectable = true;
            photoFrames[4].IsSelectable = true;
            photoFrames[5].IsSelectable = true;
            photoFrames[6].IsSelectable = true;
            photoFrames[7].IsSelectable = true;
            photoFrames[8].IsSelectable = true;
            photoFrames[9].IsSelectable = true;
            photoFrames[10].IsSelectable = true;
            photoFrames[11].IsSelectable = true;
            photoFrames[12].IsSelectable = true;
            photoFrames[13].IsSelectable = true;
            photoFrames[14].IsSelectable = true;
            photoFrames[15].IsSelectable = true;
            photoFrames[16].IsSelectable = true;
            photoFrames[17].IsSelectable = true;
            photoFrames[18].IsSelectable = true;
            photoFrames[19].IsSelectable = true;
            photoFrames[20].IsSelectable = true;
            photoFrames[21].IsSelectable = true;

            //Wiring up events
            photoFrames[0].MouseLeftClick += new EventHandler(photoframeBatsman_LeftKeySelected);
            photoFrames[1].MouseLeftClick += new EventHandler(photoframeBatsman_LeftKeySelected);
            photoFrames[2].MouseLeftClick += new EventHandler(photoframeBowler_LeftKeySelected);
            photoFrames[3].MouseLeftClick += new EventHandler(photoframeBowler_LeftKeySelected);
            photoFrames[0].MouseLeftDoubleClick += new EventHandler(PhotoFrameActiveBatsMan_MouseLeftDoubleClick);
            photoFrames[1].MouseLeftDoubleClick += new EventHandler(PhotoFrameActiveBatsMan_MouseLeftDoubleClick);
            photoFrames[2].MouseLeftDoubleClick += new EventHandler(PhotoFrameActiveBowler_MouseLeftDoubleClick);
            photoFrames[3].MouseLeftDoubleClick += new EventHandler(PhotoFrameActiveBowler_MouseLeftDoubleClick);

            photoFrames[4].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[5].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[6].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[7].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[8].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[9].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[10].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[11].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[12].MouseLeftDoubleClick += new EventHandler(photoFramesBatsman_DblClickSelected);
            photoFrames[13].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[14].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[15].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[16].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[17].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[18].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[19].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[20].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);
            photoFrames[21].MouseLeftDoubleClick += new EventHandler(photoFramesBowler_DblClickSelected);

        }

    }
}